package com.shenjies88.practice.baseframework.tools;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Slf4j
@Component
public class DateTimeTools {

    @Tool(description = "获取当前时间")
    public String getCurrentDateTime() {
        log.info("调用了getCurrentDateTime");
        return LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }

    @Tool(description = "获取前一天时间")
    public String getTheDayBefore() {
        log.info("调用了getTheDayBefore");
        return LocalDateTime.now().plusDays(-1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }

}